<?php
declare (strict_types = 1);

namespace app\shop\controller;

use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use app\common\service\UserService\MemberService;
use app\common\service\StoreService\VipService;
use app\BaseShopController;
use think\Request;

/**
 * @Group("Member")
 * @Middleware({shopMiddileware::class})
 */
class Member extends BaseShopController
{
    
    /**
     * 获取会员列表分页
     * @Route("getMemberListByPage",method="GET")
     * @return string
     */
    public function getMemberListByPage() {
        $param= $this->_data;
        $param['cid']= $this->_master_user['cid'];
        if(isset($param['cb_id'])&&$param['cb_id']>0){
            $param['cb_id']=$this->_data['cb_id'];
        }elseif($this->_master_user['cb_id']>0){
            $param['cb_id']= $this->_master_user['cb_id'];
        }
        $result = callApi(MemberService::class, 'memberList',$param);
        return apiResponse($result);
    }
    
    /**
     * 获取会员充值记录分页
     * @Route("getVipOrderListByPage",method="GET")
     * @return string
     */
    public function getVipOrderListByPage() {
        $param= $this->_data;
        $param['cid']= $this->_master_user['cid'];
        if(isset($param['cb_id'])&&$param['cb_id']>0){
            $param['cb_id']=$this->_data['cb_id'];
        }elseif($this->_master_user['cb_id']>0){
            $param['cb_id']= $this->_master_user['cb_id'];
        }
        $result = callApi(VipService::class, 'vipOrderList',$param);
        return apiResponse($result);
    }
}